<%@ include file="/common/taglibs.jsp"%>
<%@ page language="java" pageEncoding="UTF-8"%>
  <%@ include file="/common/extjs.jsp"%>
<script type="text/javascript" >

 /** 
 * 附件管理窗口
 */
 function showUploadWin(no)  {
	 var projectid ='${(empty param.projectId) ?(projectInfo.projectId):(param.projectId)}';
	 var fid ='${param.fid}';
        if(no ==1){
           var tableName = "acceptanceJiaogongCheckReport";
           var tableField = [['acceptanceJiaogongCheckReport','《公路工程交工验收情况报告》']
  					 ];
         projectAttachment.init(projectid,fid,tableName,tableField);
         projectAttachment.showUploadJquery("《公路工程交工验收情况报告》");
        }else if(no ==2){
        	var tableName = "acceptanceConstructionReport";
            var tableField = [['acceptanceConstructionReport','施工单位工作总结报告']
    					 ];
           projectAttachment.init(projectid,fid,tableName,tableField);
           projectAttachment.showUploadJquery("施工单位工作总结报告 ");
          }else if(no ==3){
        	  var tableName = "acceptanceSupervisionReport";
          var tableField = [['acceptanceSupervisionReport','监理单位工作总结报告 ']
  					 ];
         projectAttachment.init(projectid,fid,tableName,tableField);
         projectAttachment.showUploadJquery("监理单位工作总结报告");
        }else if(no ==4){
        	var tableName = "acceptanceConstructionQualityEvaluate";
          var tableField = [['acceptanceConstructionQualityEvaluate','施工单位工程质量评定资料  ']
  					 ];
         projectAttachment.init(projectid,fid,tableName,tableField);
         projectAttachment.showUploadJquery("施工单位工程质量评定资料 ");
        }else if(no ==5){
        	var tableName = "acceptanceSupervisionQualityEvaluate";
          var tableField = [['acceptanceSupervisionQualityEvaluate','监理单位工程质量评定资料']
  					 ];
         projectAttachment.init(projectid,fid,tableName,tableField);
         projectAttachment.showUploadJquery("监理单位工程质量评定资料 ");
        }else if(no ==6){
        	var tableName = "acceptanceUnitBigDesign";
          var tableField = [['acceptanceUnitBigDesign','单位工程重大设计变更资料']
  					 ];
         projectAttachment.init(projectid,fid,tableName,tableField);
         projectAttachment.showUploadJquery("单位工程重大设计变更资料 ");
        }else if(no ==7){
        	var tableName = "acceptanceDateAcceptanceCertificate";
            var tableField = [['acceptanceDateAcceptanceCertificate','公路工程交工验收证书']
    					 ];
           projectAttachment.init(projectid,fid,tableName,tableField);
           projectAttachment.showUploadJquery("公路工程交工验收证书 ");
          }else if(no ==8){
          	var tableName = "acceptanceJiaoGongCheckedReport";
            var tableField = [['acceptanceJiaoGongCheckedReport','公路工程交工验收报告']
    					 ];
           projectAttachment.init(projectid,fid,tableName,tableField);
           projectAttachment.showUploadJquery("公路工程交工验收报告");
          }else if(no ==9){
          	var tableName = "acceptanceDetectionIdeaReply";
            var tableField = [['acceptanceDetectionIdeaReply','交工检测意见整改回复']
    					 ];
           projectAttachment.init(projectid,fid,tableName,tableField);
           projectAttachment.showUploadJquery("交工检测意见整改回复 ");
          }else if(no ==10){
          	var tableName = "acceptanceSuperviseReply";
            var tableField = [['acceptanceSuperviseReply','监督过程整改回复']
    					 ];
           projectAttachment.init(projectid,fid,tableName,tableField);
           projectAttachment.showUploadJquery("监督过程整改回复");
          }else if(no ==11){
          	var tableName = "acceptanceOtherFile";
            var tableField = [['acceptanceOtherFile','其它有关资料']
    					 ];
           projectAttachment.init(projectid,fid,tableName,tableField);
           projectAttachment.showUploadJquery("其它有关资料 ");
          }
   }  


 
Ext.onReady(function(){
  Ext.QuickTips.init();
  var myData = [
                ['1','1','《公路工程交工验收情况报告》'],
                ['2','2','施工单位工作总结报告'],
                ['3','3','监理单位工作总结报告'],
                ['4','4','施工单位工程质量评定资料'],
                ['5','5','监理单位工程质量评定资料'],
                ['6','6','单位工程重大设计变更资料'],
                ['7','7','公路工程交工验收证书'],
                ['8','8','公路工程交工验收报告'],
                ['9','9','交工检测意见整改回复'],
                ['10','10','监督过程整改回复'],
                ['11','11','其它有关资料']
    ];
     // Record
    MpacceptanceAffix = Ext.data.Record.create([
                                    {name: 'no', type: 'string'},
    								{name: 'kind', type: 'string'},
    								{name: 'file', type: 'string'},
    ]);
    
    // create the data store
    var store = new Ext.data.Store({
        reader: new Ext.data.ArrayReader(
        {
            idIndex: 0  // id for each record will be the first element
        },MpacceptanceAffix)
    });
  store.loadData(myData);
  
  var cm = new Ext.grid.ColumnModel([
       {header: "序号", width: 45, dataIndex: 'no'},
       {header: "kind", width: 75, dataIndex: 'kind',hidden: true},
       {id:'file',header: "交工质量检测报告（公路）申请材料表", width: 360, dataIndex: 'file',renderer:Jinyi.project.Format.textAreaRenderer},
       {
					           header:  	'资料查询',
							   align: 'center',
								dataIndex : '',
					           renderer: function(value, metaData, record, rowIndex, colIndex, store) {
					            var no = record.get('no');
					          //  if(no == 2){
					            //    return; 
					           // }
					            var href = "<span class='upload_renderer'><a href='javascript:showUploadWin(\""+no+"\")' >查看资料</a></span>";
					            return href;
					           },  
					           width: 		180
     	 }
  
  ]);
  
   // create the Grid
    var grid = new Ext.grid.GridPanel({
        store: store,
        cm: cm,
        tbar:[{text:"批量下载",handler:function(){
        	 var projectid ='${(empty param.projectId) ?(projectInfo.projectId):(param.projectId)}';
        	 var fid ='${param.fid}';
        	location.href = "${ctx}/attachment/attachment!downloadMany.action?tableId="+fid+"&partId="+projectid;
        }}],
        width: 800,
        height: 500,
        sm:	new Ext.grid.RowSelectionModel({singleSelect:true}),
        frame:true,
		viewConfig: {
       		forceFit: false,
        	getRowClass: function(record, index) {
   			 }
   			},
        loadMask:true, 
        autoExpandColumn: 'file'
    });
    
    var viewport = new Ext.Viewport({
        layout:'fit',
        items:[grid]
        });
})
</script>
<body>
<div id="mpacceptanceAffixGrid"></div>
</body>



